home *** CD-ROM | disk | FTP | other *** search
- /* $VER: PGPAddToKeyRing.thor 3.1 (06.02.95)
- *
- * Arexx script to add a PGP key to the public keyring. The key is taken
- * from the current message in Thor.
- *
- * Script by: Eivind Nordseth, Ultima Thule Software.
- */
-
- /* trace results */
-
- options results
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- if ~show('p', 'BBSREAD') then do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- filename = 't:pgptext'
-
- address command
- if exists(filename) then 'delete >nil:' filename
-
- address(thorport)
- SAVEMESSAGE CURRENT FILE filename NOHEADER
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"Not able to save current message."' BT '"_Ok"'
- exit
- end
-
- address command 'search >nil:' filename '"BEGIN PGP PUBLIC KEY" QUICK QUIET'
- if(rc = 5) then
- do
- REQUESTNOTIFY TEXT '"This message contains no PGP key."' BT '"_Ok"'
- exit
- end
-
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"Search failed. Check path."' BT '"_Ok"'
- exit
- end
-
- GETGLOBALCONFIG CFG
- if(rc ~= 0) then exit
-
- address BBSREAD GETGLOBALDATA stem GLOBALDATA
- if(rc ~= 0) then exit
-
- Call Close 'STDOUT'
- Call Close 'STDIN'
- Call Open 'STDOUT','CON:0/13//150/PGPAmiga/SCREEN' || CFG.PUBSCREENNAME
- Call Pragma '*','STDOUT'
- Call Open 'STDIN','*'
-
- if GLOBALDATA.PGPCommand = '' then
- do
- call getpath
- pgpcommand = result
- end
- else pgpcommand = GLOBALDATA.PGPCOMMAND
-
- address command pgpcommand filename ' -ka'
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"PGP failed. Check Global Config or PGPPATH envirorment variable."' BT '"_Ok"'
- exit
- end
-
- if exists(filename) then address command 'delete >nil:' filename
- exit 0
-
-
- getpath: procedure
- address command 'GetEnv >PIPE:PGPPATH PGPPATH'
- If rc = 0 Then
- Do
- If Open('ppath','PIPE:PGPPATH','R') Then
- Do
- path = ReadLN('ppath')
- If ~Close('ppath') Then Nop
- path = path||'/PGP'
- Return path
- End
- Else Return ""
- End
-